Code coverage report for src/browser/detection.js

Statements: 88.89% (8 / 9)      Branches: 50% (2 / 4)      Functions: 100% (1 / 1)      Lines: 88.89% (8 / 9)      Ignored: none     

All files » src/browser/ » detection.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31                      1       1 1 1   1         1     1      
// This detection.js module is used to encapsulate any ugly browser/feature
// detection we may need to do.
 
// Figure out which version of IE we're using, if any.
// This is gleaned from http://stackoverflow.com/questions/5574842/best-way-to-check-for-ie-less-than-9-in-javascript-without-library
// Will return an integer on IE (i.e. 8)
// Will return undefined otherwise
function getIEVersion() {
	var undef;
	if (!document) {
		return undef;
	I}

  var v = 3,
    div = document.createElement('div'),
    all = div.getElementsByTagName('i');
 
  while (
    div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->',
      all[0]
    );
 
  return v > 4 ? v : undef;
}

var Detection = {
  ieVersion: getIEVersion
};
 
module.exports = Detection;